package com.lanyou.cook.entitylistener.domain;

import javax.persistence.PrePersist;
import javax.persistence.PreRemove;
import javax.persistence.PreUpdate;

import com.lanyou.cook.datadictionary.UserLogOpt;
import com.lanyou.cook.entity.domain.DBlinkInterface;
import com.lanyou.cook.service.UserLogService;

public class DBlinkInterfaceEntityListenerForLog {

	@PrePersist
	public void prePersist(DBlinkInterface target) {
		String content = String.format("新增DBLink关联接口“%s”", target.getName());
		UserLogService.getInstance().save(UserLogOpt.MaintenanceDBlinkInterface, null, content);
	}
	
	@PreUpdate
	public void preUpdate(DBlinkInterface target) {
		String content = String.format("修改DBlink关联接口“%s”", target.getName());
		UserLogService.getInstance().save(UserLogOpt.MaintenanceDBlinkInterface, null, content);
	}
	
	@PreRemove
	public void preRemove(DBlinkInterface target) {
		String content = String.format("删除DBlink关联接口“%s”", target.getName());
		UserLogService.getInstance().save(UserLogOpt.MaintenanceDBlinkInterface, null, content);
	}
	
}
